home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / tcp_ip / os2 / pmnos11s / mkdep.c < prev    next >
C/C++ Source or Header  |  1993-07-30  |  904b  |  44 lines

  1. /* Simple-minded program that generates dependencies for a makefile.
  2.  * Does not process #ifdefs, so some spurious dependencies may be
  3.  * generated.
  4.  *
  5.  * Copyright 1991 Phil Karn, KA9Q
  6.  */
  7. #include <stdio.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10.  
  11. char include[] = "#include";
  12. main(argc,argv)
  13. int argc;
  14. char *argv[];
  15. {
  16.     int i;
  17.     FILE *fp;
  18.     char buf[512],*cp,*cp1;
  19.  
  20.     for(i=1;i<argc;i++){
  21.         strcpy(buf,argv[i]);
  22.         if((cp = strchr(buf,'.')) == NULL)
  23.             continue;
  24.         *cp = '\0';
  25.         printf("%s.obj: %s",buf,argv[i]);
  26.         fp = fopen(argv[i],"r");
  27.         while(fgets(buf,512,fp) != NULL){
  28.             if(strncmp(buf,include,sizeof(include)-1) != 0)
  29.                 continue;
  30.             if((cp = strchr(buf,'\"')) == NULL)
  31.                 continue;
  32.             cp++;
  33.             if((cp1 = strchr(cp,'\"')) == NULL)
  34.                 continue;
  35.             putchar(' ');
  36.             while(cp != cp1)
  37.                 putchar(*cp++);
  38.         }
  39.         putchar('\n');
  40.         fclose(fp);
  41.     }
  42.     return 0;
  43. }
  44.